<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/layout/template.xhtml">
	<ui:define name="pageTitle">
		<h:outputText value="#{msg['page.title.lista.agenda']}" />
	</ui:define>

	<ui:define name="content">


		<h:form>
			<p:messages id="messages" showDetail="false" autoUpdate="true" closable="true" />
	
			<div style="margin: 10px;">
				<h:commandButton value="#{msg['button.cadastrar']}" action="#{compromissoBean.preparaInclusaoCompromisso()}" styleClass="btn btn-info" />
			</div>

			<p:dataTable id="agendaParlamentarTable" var="compromisso" value="#{compromissoBean.compromissos}" paginator="true"
				emptyMessage="Não existe Dados"
				style="margin: 0 0 0 0px; font-size:0.6em; width: 500px; height: 300px; text-align: center;"
				rows="10" paginatorPosition="bottom"
				paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
				currentPageReportTemplate=" {startRecord} de {endRecord} - Total Registro: {totalRecords}">

				<f:facet name="header">
					<small style="font-size: 1.7em;"> <h:outputText value="#{msg['label.listagem']} da Agenda do Parlamentar" /></small>
				</f:facet>


				<p:columnGroup type="header">
					<p:row>
						<p:column headerText="#" />
						<p:column headerText="Descrição" />
						<p:column headerText="Data e Hora de Inicio" />
						<p:column headerText="Data e Hora do Término" />
						<p:column headerText="Prioridade" />
						<p:column colspan="2" style="width:80px;" headerText="Operação" />
					</p:row>
				</p:columnGroup>

				<p:column>
					#{compromisso.id}
				</p:column>

				<p:column sortBy="#{compromisso.descricao}">
					#{compromisso.descricao}
				</p:column>

				<p:column style="width: 130px;">
					<h:outputText value="#{compromisso.dataInicio}">
						<f:convertDateTime pattern="dd/MM/yyyy HH:mm" type="time" dateStyle="short" timeZone="GMT-3"/>
					</h:outputText>
				</p:column>

				<p:column style="width: 130px;">
					<h:outputText value="#{compromisso.dataTermino}">
						<f:convertDateTime pattern="dd/MM/yyyy HH:mm" timeZone="GMT-02:00"/>
					</h:outputText>
				</p:column>

				<p:column style="width: 60px;">
					<h:outputText value="#{compromisso.prioridade}"/>
				</p:column>

				<p:column>
					<p:commandLink title="Alterar" styleClass="ui-icon ui-icon-pencil"
					 action="#{compromissoBean.preparaAlteracaoCompromisso(compromisso)}" />
				</p:column>
				<p:column>
					<p:commandLink styleClass="ui-icon ui-icon-trash" title="Excluir"
					action="#{compromissoBean.excluirCompromisso(compromisso)}" />
				</p:column>

			</p:dataTable>
		</h:form>

	</ui:define>
</ui:composition>
</html>